package com.hualan.dao.impl;

import com.hualan.bean.PanghuCommunity;
import com.hualan.dao.CommunityUpdateDao;
import com.hualan.utils.C3p0Util;


/**
 * 新增 编辑小区
 */
public class CommunityUpdateDaoImpl implements CommunityUpdateDao {
    @Override
    public int addCommunity(String communityName,  String communityProvince, String communityCity, String communityDistrict, Integer communityAreaCode, String communityLatitude, String communityLongitude, String communityAddress, String communityCoordinates) {
        String sql = "insert into panghu_community(community_name,community_province,community_city,community_district,community_area_code,community_latitude,community_longitude,community_address,community_coordinates) values(?,?,?,?,?,?,?,?,?)";
        int update = C3p0Util.update(sql, communityName, communityProvince, communityCity, communityDistrict, communityAreaCode, communityLatitude, communityLongitude, communityAddress, communityCoordinates);
        return update;
    }

    @Override
    public int updateCommunity(PanghuCommunity community) {
        String sql = "update panghu_community set community_name = ?,community_province = ?,community_city = ?,community_district = ?,community_latitude = ?,community_longitude = ?,community_address = ? where community_id = ? ";
        int update = C3p0Util.update(sql, community.getCommunityName(), community.getCommunityProvince(), community.getCommunityCity(), community.getCommunityDistrict(), community.getCommunityLatitude(), community.getCommunityLongitude(), community.getCommunityAddress(), community.getCommunityId());
        return update;
    }
}
